﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLNS_Public;
using System.Data;

namespace QLNS_Data
{
  public  class PhongBan_Data
    {
      KetNoiCSDL_Data kn = new KetNoiCSDL_Data();

      public DataTable LayDuLieu()
      {
          return kn.LayDuLieu("Load_tbl_PhongBan");
      }
      public int update_PhongBan(PhongBan_Public maPhong, PhongBan_Public tenPhong, PhongBan_Public dienThoai, PhongBan_Public ghiChu)
      {
          int n = 4;
          string[] name = new string[n];
          object[] value = new object[n];
          name[0] = "@MaPhong";
          value[0] = maPhong.MaPhong;
          name[1] = "@TenPhong";
          value[1] = tenPhong.TenPhong;
          name[2] = "@DienThoai";
          value[2] = dienThoai.DienThoai;
          name[3] = "@GhiChu";
          value[3] = ghiChu.GhiChu;
          return kn.update("Update_PhongBan",name,value,n);
      }

      public int insert_PhongBan(PhongBan_Public tenPhong, PhongBan_Public dienThoai, PhongBan_Public ghiChu)
      {
          int n =3;
          string[] name = new string[n];
          object[] value = new object[n];
          name[0] = "@TenPhong";
          value[0] = tenPhong.TenPhong;
          name[1] = "@DienThoai";
          value[1] = dienThoai.DienThoai;
          name[2] = "@GhiChu";
          value[2] = ghiChu.GhiChu;
          return kn.update("Insert_PhongBan", name, value, n);
      }
      public int delete_PhongBan(PhongBan_Public maPhong)
      {
          int n = 1;
          string[] name = new string[n];
          object[] value = new object[n];
          name[0] = "@MaPhong";
          value[0] = maPhong.MaPhong;
          return kn.update("Delete_PhongBan", name, value, n);
      }
    }
}
